package cate.game.farm.record;

import cate.game.play.proce.play.PlayPO;
import cate.game.role.Role;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.List;

@NoteClass("最低战力通关")
public class LowPowerPassRecord extends SinglePassRecord{

	@NoteField("战力")
	public long power;

	@Override
	protected boolean needUpdate(Role role, List<PlayPO> plays) {
		if (power <= 0) {
			return true;
		}
		long totalPower = plays.stream().mapToLong(a -> a.a.getTotalPower()).sum();
		if (totalPower < power) {
			return true;
		}
		return false;
	}

	@Override
	protected void doRecord(Role role, List<PlayPO> plays) {
		power = plays.stream().mapToLong(a -> a.a.getTotalPower()).sum();
	}
}
